package com.example.common.model

import com.example.common.api.BaseApiServer
import com.example.net.HttpInterceptorType
import com.example.net.HttpManager

abstract class BaseRepository<T: BaseApiServer> {

    private var tokenApiServer:T?=null
    private var signApiServer:T?=null
    private var uploadApiServer:T?=null
    private var commonApiServer:T?=null

    fun <T> createApiServer(clazz: Class<T>,type:HttpInterceptorType):T{
        return when(type){
            HttpInterceptorType.TOKEN->(tokenApiServer?:HttpManager.createApiServer(clazz,type))as T
            HttpInterceptorType.SIGN -> (signApiServer?:HttpManager.createApiServer(clazz,type))as T
            HttpInterceptorType.UPLOAD -> (uploadApiServer?:HttpManager.createApiServer(clazz,type))as T
            HttpInterceptorType.COMMON -> (commonApiServer?:HttpManager.createApiServer(clazz,type))as T
        }
    }




}